<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui" 
      xmlns:component="http://java.sun.com/jsf/composite/component">

    <ui:composition template="/resources/include/template.xhtml">

        <ui:define name="title">

            <h:outputText value="#{bundle.Bambole} - #{bundle.PaymentTerm}"/>

        </ui:define>

        <ui:define name="body">

            <h:form>

                <ui:include src="/resources/include/menu.xhtml"/>

                <p:panel header="#{bundle.PaymentTerm} - 
                         #{bundle.List} - 
                         #{paymentTermController.paginationFromSearch ? bundle.FoundRecords : bundle.Records}:
                         #{paymentTermController.pagination.itemsCount > 0 ? paymentTermController.pagination.pageFirstItem + 1 : ''} 
                         #{paymentTermController.pagination.itemsCount > 0 ? '...' : ''}
                         #{paymentTermController.pagination.itemsCount > 0 ? paymentTermController.pagination.pageLastItem + 1 : ''} 
                         #{paymentTermController.pagination.itemsCount > 0 ? '/' : ''}
                         #{paymentTermController.pagination.itemsCount}">

                    <component:toolbar

                        returnButtonDisabled="true"
                        editButtonDisabled="true"
                        saveButtonDisabled="true"
                        deleteButtonDisabled="true"            

                        previousButtonDisabled="#{!paymentTermController.pagination.hasPreviousPage}"
                        nextButtonDisabled="#{!paymentTermController.pagination.hasNextPage}"
                        previousButtonAction="#{paymentTermController.previous}"
                        refreshButtonAction="#{paymentTermController.refreshList}"
                        nextButtonAction="#{paymentTermController.next}"
                        createButtonAction="#{paymentTermController.prepareCreate}"
                        searchButtonAction="#{paymentTermController.prepareSearch}"

                        /> 

                    <p:spacer/>

                    <p:dataTable id="listDataTable"
                                 var="item"
                                 resizableColumns="true" 
                                 liveResize="true"
                                 value="#{paymentTermController.items}" 
                                 rowKey="#{item.id}" 
                                 rows="#{paymentTermController.pagination.pageSize}" 
                                 rowIndexVar="rowIndex"
                                 emptyMessage="#{bundle.EmptyMessage}">

                        <p:column style="width: 4%; text-align: center">

                            <p:commandLink id="openCommandLink"
                                           action="#{paymentTermController.prepareView}">

                                <img src="#{themeUtil.folderIcon}" height="16" width="16"/>

                                <f:setPropertyActionListener value="#{item}" target="#{paymentTermController.selected}"/>

                                <f:setPropertyActionListener value="#{rowIndex}" target="#{paymentTermController.selectedItemIndex}"/>

                            </p:commandLink>

                            <p:tooltip for="openCommandLink"
                                       value="#{bundle.Open}"/>

                        </p:column>

                        <p:column headerText="#{bundle.Name}"
                                  style="width: 40%">

                            #{item.nameWithDisabledFormatting}

                        </p:column>

                        <p:column headerText="#{bundle.Description}"
                                  style="width: 54%">

                            #{item.description}

                        </p:column> 

                        <p:column headerText="#{bundle.DefaultOption}" 
                                  style="width: 16%; text-align: center">

                            <p:selectBooleanCheckbox value="#{item.defaultOption}"
                                                     disabled="true"/>

                        </p:column>                        

                    </p:dataTable>          

                </p:panel>        

            </h:form>

        </ui:define>

    </ui:composition>

</html>
